Using Watch Events to Update ControlBar Data

Description

The ControlBar data can be updated automatically in response to certain events in the UX (such as the UX going dirty, a List going dirty, etc.) or by a change in the value of one or more controls. Watch Events can be defined in the ControlBar Builder inside the Data pane by first clicking the 'Add Data Item' button and then checking the 'Update value automatically based on a 'watch' events' checkbox. If a html item is placed in the ControlBar then the Watch Event can be added as a placeholder in the HTML text property.

images/we32.png
Information from an active row's 'City' field is displayed in a ControlBar using a watch event.

To see how you can configure watch events to automatically update ControlBar data follow the guide below or watch this video:

Using Watch Events to Update ControlBar Data

The ControlBar data can be updated automatically in response to certain events in the UX (such as the UX going dirty, a List going dirty, etc.) or by a change in the value of one or more controls.

In this video we show how you can configure watch events to automatically update ControlBar data.

2016-09-14

Adding a Watch Event

  1. In the ControlBar Builder open the 'Data' pane. Click the 'Add Data Item' button.

    images/we18.png
  2. In the Setting dialog give the new data item the name 'newValue'.

    images/we19.png
  3. Check the 'Update value automatically based on a 'watch' event.

    images/we20.png
  4. Click the 'Select' button next to the 'Controls to watch:' control box. Select the list you defined, list1.

    images/we21.png
  5. Enter the JavaScript to execute when the watched controls change. The example below sets the variable to the current value for a List called "LIST1".

    var listValue = {dialog.object}.getValue('LIST1');
    return listValue;
    images/we22.png
  6. Open the Items pane and click the 'Add ControlBar Item'

    images/we23.png
  7. From the 'Item Type' choices select 'html' and click OK.

    images/we24.png
  8. Highlight the html item. Click the button next to the 'HTML text' property under HTML Settings section.

    images/we25.png
  9. Double click on the {newValue} placeholder in the Available Placeholders list. The placeholder should appear in the HTML work area on the right. Click OK.

    images/we26.png
  10. Open the 'ControlBar Layout' pane. Click the 'Add Layout' button. Give the new layout a name like 'Layout1'.

    images/we27.png
  11. Click the 'Add Line' button.

    images/we28.png
  12. In the 'Edit Layout Line' dialog click the 'Add' button underneath the 'Middle' section.

    images/we29.png
  13. Select the HTML item that was defined, Html1. Click OK and OK again to close the ControlBar Builder.

    images/we30.png
  14. Run the component in Live Preview.

    images/we31.png
  15. Use the arrow keys on the keyboard to scroll through the list control. The Watch Event should update the ControlBar data.

    images/we32.png